package com.itheima.dao;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Userdao {

    //查询所有
    @Select("select*from user")
    List<User> findall();

    //增加
    @Insert("insert into user (username,address,sex,birthday) values( #{username},#{address},#{sex},#{birthday})")
    void zhujieadd(User user);

    //修改分两步,第一步是查询 第二步是添加
    @Update("update user set username=#{username},address=#{address},sex=#{sex},birthday=#{birthday} where id=#{id}")
    void zhujiexiugai(User user);

    //删除操作
    @Delete("delete from user where id=#{id}")
    void  zhujieshanchu(int id);

    //模糊查询
    @Select("select * from user where username like #{username}")
    List<User> muhuchaxun(String zifu);

    //模糊查询
    @Select("select * from user where username like #{id}")
    List<User> muhuchaxun2(String id);


}
